package com.niuxiaofa.newlaw.Activity;

import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
import android.widget.PopupWindow;
import android.widget.TextView;

import androidx.recyclerview.widget.RecyclerView;

import com.niuxiaofa.newlaw.Base.BaseActivity;
import com.niuxiaofa.newlaw.Bean.AdvisoryTagBean;
import com.niuxiaofa.newlaw.Bean.DemandTagsBean;
import com.niuxiaofa.newlaw.Network.WisdomLibraryPresenter;
import com.niuxiaofa.newlaw.R;
import com.niuxiaofa.newlaw.Tools.RecyclerViewHelp;
import com.niuxiaofa.newlaw.Tools.ToActivityUtil;
import com.niuxiaofa.newlaw.adapter.ConsultationAdapter;
import com.niuxiaofa.newlaw.adapter.DemandTagsAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import www.linwg.org.lib.LCardView;


/**
 *
 * 服务
 *
 */
public class ServiceActivity extends BaseActivity implements WisdomLibraryPresenter.interface_demandTags {


    DemandTagsAdapter demandTagsAdapter;

    List<DemandTagsBean.DataDTO> list = new ArrayList<>();


    @BindView(R.id.recyclerview)
    RecyclerView recyclerview;


    @BindView(R.id.lcard)
    LCardView lcard;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_service;
    }

    @Override
    protected void initData() {

        WisdomLibraryPresenter.demandTags(this);

        demandTagsAdapter = new DemandTagsAdapter(list, new DemandTagsAdapter.Onclick() {
            @Override
            public void onclick(int c) {

            }
        });
        lcard.setOnClickListener(e->{
            ToActivityUtil.toNextActivity(ReleaseRequirementsActivity.class);
        });


        RecyclerViewHelp.setRecyclerGridLayout(recyclerview, 0, 4)
                .setAdapter(demandTagsAdapter);
    }

    @Override
    public void getResponse(DemandTagsBean u) {
        if (u.getCode() == 1) {
            list.addAll(u.getData());
            demandTagsAdapter.notifyDataSetChanged();
        }
    }
}
